﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PageTemplate.Master" AutoEventWireup="true" CodeBehind="ViewReservations.aspx.cs" Inherits="RMS.Pages.Admin.ViewReservations" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" runat="server">

    <%  //Get the name of the Retreat and display it
        RMS.Models.Repository.Repository repo = new RMS.Models.Repository.Repository();
        int retID = (int)Session["RetreatID"];
        RMS.Models.Retreat retreat = repo.GetRetreat(retID);
        Response.Write("<h9>" + retreat.Ret_Title + "</h9><hr /><br />");

        //Check if there are any reservations for this Retreat
        IEnumerable<RMS.Models.Reservation> r = GetReservations();
        if(r.Count() == 0)   
            Response.Write("<span class=\"normalText\">No reservations currently scheduled for this retreat.</span>");
        %>
    
    
    <asp:ListView ID="ListView1" ItemType="RMS.Models.Reservation" SelectMethod="GetReservations"
        DataKeyNames="ResId" UpdateMethod="UpdateReservation"
        DeleteMethod="DeleteReservation" InsertMethod="InsertRetreat"
        InsertItemPosition="LastItem" 
        EnableViewState="false" runat="server">

        <LayoutTemplate>
             
            <table class="editReservationTable" runat="server" id="itemPlaceholder"> 
                
           </table>

        </LayoutTemplate>

        <ItemTemplate>
            <table class="editReservationTable">
                <tr>
                    <td>First Name:</td>
                    <td><%# Item.Res_Fname %></td>
                </tr>
                <tr>
                    <td>Last Name:</td>
                    <td><%# Item.Res_Lname %></td>
                </tr>
                 <tr>
                    <td>Address:</td>
                    <td><%# Item.Res_Address %></td>
                </tr>
                <tr>
                    <td>City:</td>
                    <td><%# Item.Res_City %></td>
                </tr>
                <tr>
                    <td>State: </td>
                    <td><%# Item.Res_State %></td>
                </tr>
                <tr>
                    <td>Zip Code</td>
                    <td><%# Item.Res_Zipcode %></td>
                </tr>

                <tr>
                    <td>Phone Number:</td>
                    <td><%# Item.Res_Phone %></td>
                </tr>
                <tr>
                    <td>Email Address:</td>
                    <td><b><%# Item.Res_Email %></b></td>
                </tr>
                 <tr>
                    <td>Choosen Date: </td>
                    <td><%# Item.Res_Chosen_Date %></td>
                 </tr>
                <tr>
                    <td>Require First Floor?</td>
                    <td><%# Item.Res_First_Floor %></td>
                </tr>
                <tr>
                    <td>Dietary Needs?</td>
                    <td><%# Item.Res_Diet_Needs %></td>
                </tr>
                <tr>
                    <td>Multiple Guests?</td>
                    <td><%# Item.Res_Multiple_Guests %></td>
                </tr>
                <tr>
                    <td>Guest Info:</td>
                    <td><%# Item.Res_Guest_Info %></td>
                </tr>
                <tr>
                    <td>Payment Method:</td>
                    <td><b><%# checkOrCredit(Item.Res_Pay_Check, Item.Res_Pay_Credit) %></b></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td> 
                        <asp:Button CssClass="myButton" ID="Button1" CommandName="Edit" Text="Edit" runat="server" />
                        <asp:Button CssClass="myButton" ID="Button2" CommandName="Delete" Text="Delete" runat="server" />
                    </td>
                </tr>
                   
            </table>
            <hr />            
                    
        </ItemTemplate>

        <EditItemTemplate>
                 <table class="editReservationTable">
                <tr>
                    <td>First Name:</td>
                    <td>
                        <input class="txtbxcomp lettersOnly" name="Res_FName" value="<%# Item.Res_Fname %>" />
                        <input type="hidden" name="ResId" value="<%# Item.ResId %>" />
                    </td>
                </tr>
                <tr>
                    <td>Last Name:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Res_LName" value="<%# Item.Res_Lname %>" /></td>
                </tr>
                 <tr>
                    <td>Address:</td>
                    <td><input class="txtbxcomp" name="Res_Address" value="<%# Item.Res_Address %>" /></td>
                </tr>
                <tr>
                    <td>City:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Res_City" value="<%# Item.Res_City %>" /></td>
                </tr>
                <tr>
                    <td>State:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Res_State" value="<%# Item.Res_State %>" /></td>
                </tr>
                <tr>
                    <td>Zip Code:</td>
                    <td><input class="txtbxcomp numbersOnly" name="Res_Zipcode" value="<%# Item.Res_Zipcode %>" /></td>
                </tr>

                <tr>
                    <td>Phone Number:</td>
                    <td><input class="txtbxcomp numbersOnly" name="Res_Phone" value="<%# Item.Res_Phone %>" /></td>
                </tr>
                <tr>
                    <td>Email Address:</td>
                    <td><input class="txtbxcomp" name="Res_Email" value="<%# Item.Res_Email %>" /></td>
                </tr>
                 <tr>
                    <td>Choosen Date:</td>
                    <td><input class="txtbxcomp" name="Res_Chosen_Date" value="<%# Item.Res_Chosen_Date %>" /></td>
                    
                 </tr>
                <tr>
                    <td>Require First Floor?</td>
                    <td>
                        <select class="largetxtbxcomp" name="Res_First_Floor" >
                            <option selected="selected"><%# Item.Res_First_Floor %></option>
                            <option value="<%# returnOpposite(Item.Res_First_Floor) %>"><%# returnOpposite(Item.Res_First_Floor) %></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>Dietary Needs?</td>
                    <td>
                        <select class="largetxtbxcomp" name="Res_Diet_Needs" >
                            <option selected="selected"><%# Item.Res_Diet_Needs %></option>
                            <option value="<%# returnOpposite(Item.Res_Diet_Needs) %>"><%# returnOpposite(Item.Res_Diet_Needs) %></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>Multiple Guests?</td>
                    <td>
                        <select class="largetxtbxcomp" name="Res_Multiple_Guests" >
                            <option selected="selected"><%# Item.Res_Multiple_Guests %></option>
                            <option value="<%# returnOpposite(Item.Res_Multiple_Guests) %>"><%# returnOpposite(Item.Res_Multiple_Guests) %></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>Guest Info:</td>
                    <td><textarea class="largetxtbxcomp" rows="4" cols="64" name="Res_Guest_Info"><%# Item.Res_Guest_Info %></textarea></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td> 
                        <asp:Button CssClass="myButton" ID="Button3" CommandName="Update" Text="Update" runat="server"/>
                        <asp:Button CssClass="myButton" ID="Button4" CommandName="Cancel" Text="Cancel" runat="server"/>
                    </td>
                </tr>
                   
            </table>
            <hr />           
            
        </EditItemTemplate>
             
        <InsertItemTemplate></InsertItemTemplate>
    </asp:ListView>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SidebarContent" runat="server">
    <span><a href="/pages/UserAccount.aspx">View Admin Account</a></span>
    <span><a class="selected" href="/admin/retreats">Edit, Remove, or View Retreats</a></span>
    <span><a href="/admin/addretreat">Add Retreats</a></span>
    <span><a href="/admin/reports">Generate Reports</a></span>
    <span><a href="/pages/admin/Users.aspx">Edit, Remove, or View Users</a></span>
    <span><a href="/pages/CreateAccount.aspx">Add Users</a></span>
</asp:Content>
